package com.cos.emp.rjz9emp.services.impl;

import com.cos.emp.rjz9emp.dao.EmpMapper;
import com.cos.emp.rjz9emp.entity.Emp;
import com.cos.emp.rjz9emp.services.EmpServices;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: COS
 * @time: 2021/12/24 11:24
 * @description:
 */
@Service
public class EmpServicesImpl implements EmpServices {
    @Resource
    private EmpMapper empMapper;

    @Override
    public List<Emp> getAll() {
        return empMapper.getAll();
    }

    @Override
    public PageInfo<Emp> getEmpByPage(Integer pageNum, Double startSalary, Double endSalary, String ename) {
        PageHelper.startPage(pageNum, 5);
        List<Emp> el = empMapper.getEmpByPage(startSalary,endSalary,ename);
        PageInfo<Emp> info = new PageInfo<>(el);
        return info;
    }
}
